﻿using System;
using System.Collections.Generic;

namespace Mono.Cecil.Metadata
{
	// Token: 0x020000FC RID: 252
	internal sealed class GuidHeapBuffer : HeapBuffer
	{
		// Token: 0x170002BD RID: 701
		// (get) Token: 0x06000A31 RID: 2609 RVA: 0x0002E2DC File Offset: 0x0002C4DC
		public override bool IsEmpty
		{
			get
			{
				return this.length == 0;
			}
		}

		// Token: 0x06000A32 RID: 2610 RVA: 0x00005A48 File Offset: 0x00003C48
		public GuidHeapBuffer() : base(16)
		{
		}

		// Token: 0x06000A33 RID: 2611 RVA: 0x0002E2F8 File Offset: 0x0002C4F8
		public uint GetGuidIndex(Guid guid)
		{
			uint num;
			bool flag = this.guids.TryGetValue(guid, out num);
			uint result;
			if (flag)
			{
				result = num;
			}
			else
			{
				num = (uint)(this.guids.Count + 1);
				this.WriteGuid(guid);
				this.guids.Add(guid, num);
				result = num;
			}
			return result;
		}

		// Token: 0x06000A34 RID: 2612 RVA: 0x00005A5F File Offset: 0x00003C5F
		private void WriteGuid(Guid guid)
		{
			base.WriteBytes(guid.ToByteArray());
		}

		// Token: 0x04000422 RID: 1058
		private readonly Dictionary<Guid, uint> guids = new Dictionary<Guid, uint>();
	}
}
